import { ChangeActivity } from './changeActivity-model.js';
var changeActivity = new ChangeActivity();

Page({
    /**
     * 页面的初始数据
     **/
    data: {
        activityList: null
    },
    /*
    * 生命周期函数--监听页面加载
    */
    onLoad: function (options){
        let storeNo = wx.getStorageSync('storeNo')
        changeActivity.activityIndex({storeNo},res=>{
            if(res.status){
                this.setData({
                    activityList:res.data
                })
            }
        })
    },
    change(e){
        let id = changeActivity.getDataSet(e, 'id');
        let title = changeActivity.getDataSet(e,'name');
        var pagelist = getCurrentPages();
        if (pagelist.length > 1) {
            //获取上一个页面实例对象
            var prePage = pagelist[pagelist.length - 2];
            wx.navigateBack({
                delta: 1
            })
            prePage.onLoad({
                id,
                type:'change',
                title
            });
            // setTimeout(()=>{
            //     prePage.onTabItemTap()
            // },200)
        }
       
    }

})